﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace JumpNFight.Simulation
{
    class FlyingMoveable : Moveable
    {
        public bool IsBalistic = false;
        public FlyingMoveable(int ownerID) :
            base(ownerID)
        {
        }

        public override void Move(Vector2 direction)
        {
            Velocity.X += direction.X;
            Velocity.X = MathHelper.Clamp(Velocity.X, -MaxSpeed, MaxSpeed);
            Velocity.Y += direction.Y;
            Velocity.Y = MathHelper.Clamp(Velocity.Y, -MaxSpeed, MaxSpeed);
        }

        public override void UpdateVelocity(float dt)
        {
            // does nothing (e.g. no drag, no gravity)
            if (IsBalistic)
            {
                // gravity
                Velocity.X += dt * Mass * World.Gravity.X;
                Velocity.Y += dt * Mass * World.Gravity.Y;
            }
        }
    }
}
